load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "catkv",
    srcs = [
        "catalog_query.go",
        "catalog_reader.go",
        "catalog_reader_cached.go",
        "system_database_cache.go",
        "validate.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/catalog/internal/catkv",
    visibility = ["//pkg/sql/catalog:__subpackages__"],
    deps = [
        "//pkg/clusterversion",
        "//pkg/config",
        "//pkg/config/zonepb",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/roachpb",
        "//pkg/settings/cluster",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/bootstrap",
        "//pkg/sql/catalog/catalogkeys",
        "//pkg/sql/catalog/descbuilder",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/internal/validate",
        "//pkg/sql/catalog/nstree",
        "//pkg/sql/catalog/schemadesc",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sqlerrors",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/iterutil",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/syncutil",
        "//pkg/util/tracing",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "catkv_test",
    size = "small",
    srcs = [
        "catalog_reader_test.go",
        "main_test.go",
    ],
    data = glob(["testdata/**"]),
    deps = [
        ":catkv",
        "//pkg/base",
        "//pkg/kv",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catalogkeys",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/nstree",
        "//pkg/sql/parser",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/sqlutils",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_kylelemons_godebug//diff",
        "@com_github_stretchr_testify//require",
        "@in_gopkg_yaml_v2//:yaml_v2",
    ],
)
